<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body>
        <script>
            var reverseList = function (head) {
                let pre = null
                let cur = head
                let next = null
                while (cur) {
                    next = cur.next
                    cur.next = pre
                    pre = cur
                    cur = next
                }
                return pre
            }
        </script>
    </body>
</html>
